package com.yunang.officialweb.controller;

import com.yunang.officialweb.common.R;
import com.yunang.officialweb.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.PathVariable;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RestController;


import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/OfficialWebsite")
public class NewsController {
    @Autowired
    private NewsService newsService;

    @RequestMapping(value = "/getNews", method = RequestMethod.GET)
    public R getNews(@RequestParam int id){
        return R.ok(newsService.getNews(id));
    }

    @RequestMapping(value = "/all",method = RequestMethod.GET)
    public R selectAll(){
        return R.ok( newsService.selectAll());
    }
}
